<script type="text/javascript">
/*
1、函数必须以 [函数名] = function (){} 格式声明。
2、函数必须放置在前，公用代码在后
*/
fb = function (row) {
	return {
		id: row.id,
		title: row.title,
		author: row.author,
		publisher: row.publisher
	};
}

edit = function (id) {
	$('#test').show();

	EAS_JS.Form.url = "./data/data-form.js";
	EAS_JS.Form.start();
}

EAS_JS.Table.templateID = "tempArea";
EAS_JS.Table.targetID = "targetDiv";
EAS_JS.Table.pageTargetID = "pageDiv";
EAS_JS.Table.setURL('./data/data.js');
EAS_JS.Table.rowSetF = fb;

EAS_JS.Ajax.getJSON({url : './data/data.js'});
</script>

<div style="margin: 15px 5px;">
	<span style="width: 5px;"><input name="chkall" type="checkbox" value="on" /></span>
	<span>ID</span>
	<span>title</span>
	<span>author</span>
	<span>publisher</span>

	<div id="targetDiv"></div>
</div>
<div id="pageDiv" style="float: right;"></div>

<div id="test" style="display:none;">
	<form id="form1" name="form1" method="get" onsubmit="return false;">
		<input type="hidden" name="mid" id="mid" />

		<table width="100%" class="edittable">
			<tr>
				<td align="right">Text:</td>
				<td align="left">&nbsp;<input type="text" name="title"/></td>
			</tr>
			<tr>
				<td align="right">Radio:</td>
				<td align="left">&nbsp;<input type="radio" name="r" value="1" />&nbsp;<input type="radio" name="r" value="0" /></td>
			</tr>
			<tr>
				<td align="right">Checkbox:</td>
				<td align="left">&nbsp;<input type="checkbox" name="c" value="0" />&nbsp;<input type="checkbox" name="c" value="1" checked="checked" />&nbsp;<input type="checkbox" name="c" value="2" /></td>
			</tr>
			<tr>
				<td align="right">Select-one:</td>
				<td align="left">&nbsp;<select name="so"><option value="1">test</option></select></td>
			</tr>
			<tr>
				<td align="right">Select-multiple:</td>
				<td align="left">&nbsp;<select name="sm" multiple size="5"><option value="1">test</option></select></td>
			</tr>
			<tr>
				<td align="right">Textarea:</td>
				<td align="left">&nbsp;<textarea name="content"></textarea></td>
			</tr>
		</table>
	</form>
</div>

<div id="tempArea" style="display: none;">
	<br />
	<span style="width: 5px;"><input name="chkall" type="checkbox" value="#{id}" /></span>
	<span>#{id}</span>
	<span>#{title}</span>
	<span>#{author}</span>
	<span>[<a href="javascript:;" onclick="javascript: edit('#{id}');">Edit</a>]</span>
</div>